package com.admin.persistence.sys.mapper;

import com.admin.persistence.sys.entity.UserGroup;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author jack
 * @since 2019-05-03
 */
public interface UserGroupMapper extends BaseMapper<UserGroup> {

    @Select("SELECT userGroup.* FROM USER_GROUP userGroup " +
            "INNER JOIN" +
            "(SELECT * FROM USER_USER_GROUP WHERE USER_ID = #{userId}) userUserGroup" +
            "ON" +
            "userGroup.ID = userUserGroup.USER_GROUP_ID")
     List<UserGroup> queryByUser(@Param("userId") String userId);
}
